//当前这个js文件(模块)：对所有的API接口进行统一的管理

//引入二次封装的ajax
import requests from './ajax';

//获取首页数据的接口 地址：/getDB 请求方式：get
export const reqHomeDB = () => requests({url:'getDB',method:'get'});
//获取搜索数据的接口 地址：//searchGoods 请求方式：post
export const reqSerchDB = (searchVal) => requests({url:'searchGoods',method:'post',params:{searchVal:searchVal}}); 

//获取首页数据的接口 地址：/getGoods 请求方式：get
export const getGoods = (id) => requests({url:'getGoods',method:'get',params:{id:id}});

//获取首页数据的接口 地址：/getGoods 请求方式：get
export const getGoodsList = (id) => requests({url:'getGoodsList',method:'get',params:{id:id}});

// 获取购物的数据接口 地址：/getCartList 请求方式get
export const reqCartDB = () => requests({url:'getCartList',method:'get'});

// 获取购物车产品数量
export const GetCartSum = () => requests({url:'getCartCount',method:'get'})

// 加入购物车
export const AddToCart = (params) => requests.get('addCartList',{params})


// 购物车删除接口 地址：/deleteCartList 请求方式get
export const delCartDB =(cartId) => requests({url:'/deleteCartList',method:'get',params:{id:cartId}});

// 购物车修改接口 地址：/updateCartList  请求方式get
export const alertCartDB =(cartId,num,checked) => requests({url:'/updateCartList',method:'get',params:{id:cartId,num:num,checked}});

// 全选按钮  地址：/checkedBtn
export const goodsChecked = (checked) => requests({url:'/checkedBtn',method:'get',params:{checked:checked}});

export const ck=()=> requests({url:'/goodsChecked',method:'get'});
